/**
 * Copyright ©2012-2018 HopeHaiyang Corporation, All Rights Reserved
 * http://www.wuhanhope.com
 */
package hope.platform.data.server.data.img;

import hope.platform.data.dao.WarningKindRepository;
import hope.platform.data.domain.WarningKind;
import hope.platform.data.server.data.header.WarningKindService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * class info
 *
 * @author hujia
 *         Create at 2018/7/20 16:05
 */
@Service
public class WarningKindServiceImg implements WarningKindService {

    @Autowired
    private WarningKindRepository repository;

    @Override
    public WarningKind addWarningKind(WarningKind warningKind) {
        warningKind.setGmtCreate(new Date());
        warningKind.setGmtModified(new Date());
        return repository.save(warningKind);
    }

    @Override
    public List<WarningKind> getAll() {
        return repository.findAll();
    }

    @Override
    public WarningKind getByWarningType(String warningType) {
        return repository.findByWarningType(warningType);
    }
}
